package com.gaojinqi.base.common.exception;

import com.gaojinqi.base.common.constant.RespConst;
import lombok.Data;

/**
 * 非运行时异常，可自定义继承此异常，以细化异常类别 <BR>
 *
 * @author gaojinqi
 * @version 1.0
 * @since 2020年03月19日
 */
@Data
public class BizException extends Exception implements IException {

    private static final long serialVersionUID = 6500358949756225363L;

    /**
     * 异常消息
     */
    private String message;

    /**
     * 错误代码
     */
    private int errCode = RespConst.RespEnum.BIZ.getCode();

    /**
     * 返回数据
     */
    private Object data;

    public BizException(String message) {
        super(message);
        this.message = message;
    }

    public BizException(int errCode, String message) {
        super(message);
        this.errCode = errCode;
        this.message = message;
    }

    public BizException(int errCode, String message, Object data) {
        super(message);
        this.errCode = errCode;
        this.message = message;
        this.data = data;
    }

    public BizException(String message, Exception exception) {
        super(message, exception);
        this.message = message;
    }


}
